package com.bdqn.t330.controller;

import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;

@Controller
@RequestMapping("/user")
public class UserController {

    //数据，视图
    @RequestMapping("/show")
    public String show(Model model, @RequestParam(name = "account") String account) throws UnsupportedEncodingException {
        System.out.println("account:" + account);
        //request.setAttribute(key,val)
        model.addAttribute("account", "account" + account);
        //转发
        return "/show";
    }

    //数据，视图
    @RequestMapping("/hello")
    public String hello() {
        System.out.println("hello");
        return "/hello";
    }
}
